

***** correlations

	use "$Replicationdirectory/_Work/TEMP/_data_consol_daily", clear	

					pwcorr   if default==0, star(0.01)

					pwcorr  y_consol_London y_consol_Paris if default==1, star(0.01)
					
					  eststo corr_Consol_predefault: reg   y_consol_London y_consol_Paris if default==0  , robust beta
					  eststo corr_Consol_postdefault: reg   y_consol_London y_consol_Paris if default==1 , robust beta
					  
					  esttab  corr_Consol_predefault using "$Replicationdirectory/_Work/Output/TABS/TAB_1/TAB1_A2_CONSOL_PRE.tex"   , beta replace
					  esttab  corr_Consol_postdefault using "$Replicationdirectory/_Work/Output/TABS/TAB_1/TAB1_A2_CONSOL_POST.tex"   , beta replace


					
					

  
					
*** pre default ***
	  grstyle init

  grstyle set plain, horizontal   dotted
	
	use "$Replicationdirectory/_Work/TEMP/_data_consol_daily", clear	

	local lag=4
	
	preserve 
					 
					 keep if default==0
					
					tsset daten
 					   
					tsset time, daily
					
							
				* Choose impulse response horizon
				local hmax = 5

				/* Generate LHS variables for the LPs */

				* levels
				forvalues h = 0/`hmax' {
					gen y_consol_Paris_`h' = f`h'.y_consol_Paris 
				}

				* differences
				forvalues h = 0/`hmax' {
					gen y_consol_Parisd`h' = f`h'.y_consol_Paris - l.f`h'.y_consol_Paris 
				}

				* Cumulative
				forvalues h = 0/`hmax' {
					gen y_consol_Parisc`h' = f`h'.y_consol_Paris - l.y_consol_Paris 
				}

				 
				/* Run the LPs */
				* Levels
				eststo clear
				cap drop b u d Days Zero
				gen Days = _n-1 if _n<=`hmax'
				gen Zero =  0    if _n<=`hmax'
				gen b=0
				gen u=0
				gen d=0
				forv h = 0/`hmax' {
					* levels
					 reg y_consol_Paris_`h' l(0/`lag').y_consol_London l(1/`lag').y_consol_Paris, vce(robust)
				replace b = _b[y_consol_London]                    if _n == `h'+1
				replace u = _b[y_consol_London] + 2.575* _se[y_consol_London]  if _n == `h'+1
				replace d = _b[y_consol_London] - 2.575* _se[y_consol_London]  if _n == `h'+1
				eststo
				}
				* nois esttab , se nocons keep(y_consol_London)
				gen b_level = b

				* Differences
				eststo clear
				cap drop b u d Days Zero
				gen Days = _n-1 if _n<=`hmax'
				gen Zero =  0    if _n<=`hmax'
				gen b=0
				gen u=0
				gen d=0
				forv h = 0/`hmax' {
					 reg y_consol_Parisd`h' l(0/`lag').dy_consol_London l(1/`lag').dy_consol_Paris, vce(robust)
				replace b = _b[dy_consol_London]                     if _n == `h'+1
				replace u = _b[dy_consol_London] + 2.575* _se[dy_consol_London]  if _n == `h'+1
				replace d = _b[dy_consol_London] - 2.575* _se[dy_consol_London]  if _n == `h'+1
				eststo
				}
				* nois esttab , se nocons keep(dy_consol_London)
				
						 
						
					 
						twoway ///
						(rarea u d  Days,  ///
						fcolor(gs13) lcolor(gs13) lw(none) lpattern(solid)) ///
						(line b Days, lcolor(blue) ///
						lpattern(solid) lwidth(thick)) ///
						(line Zero Days, lcolor(black)), title("{stMono:Consol} ",size(mediumsmall) color(black)) legend(off) ///
						graphregion(color(white)) plotregion(color(white)) ///
						ysc(r(-0.3 0.8)) ylabel(-0.2(0.2)0.8, angle(0) grid) xtitle("")
						* ytitle("Percent", size(medsmall)) xtitle("Days", size(medsmall)) ///

 						
						
						graph export "$Replicationdirectory/_Work/TEMP/CONSOL_Paris_London_PREDEFAULT_DIF.pdf", replace 
						graph save "$Replicationdirectory/_Work/TEMP/CONSOL_Paris_London_PREDEFAULT_DIF", replace 
						 
						
				* Cumulative
				eststo clear
				cap drop b u d Days Zero
				gen Days = _n-1 if _n<=`hmax'
				gen Zero =  0    if _n<=`hmax'
				gen b=0
				gen u=0
				gen d=0
				forv h = 0/`hmax' {
					 reg y_consol_Parisc`h' l(0/4).dy_consol_London l(1/3).dy_consol_Paris, vce(robust)
				replace b = _b[dy_consol_London]                     if _n == `h'+1
				replace u = _b[dy_consol_London] + 2.575* _se[dy_consol_London]  if _n == `h'+1
				replace d = _b[dy_consol_London] - 2.575* _se[dy_consol_London]  if _n == `h'+1
				eststo
				}
 				
	 
									
								 
								 
								 
									
															
										 
									
									
	 restore 				
					

					
*** post default ***
			
					 
					 keep if default==1
					
					tsset daten
					*keep if tin(1Jan1935,31Mar1935)
					   
					tsset time, daily
					
							
				* Choose impulse response horizon
				local hmax = 5

				/* Generate LHS variables for the LPs */

				* levels
				forvalues h = 0/`hmax' {
					gen y_consol_Paris_`h' = f`h'.y_consol_Paris 
				}

				* differences
				forvalues h = 0/`hmax' {
					gen y_consol_Parisd`h' = f`h'.y_consol_Paris - l.f`h'.y_consol_Paris 
				}

				* Cumulative
				forvalues h = 0/`hmax' {
					gen y_consol_Parisc`h' = f`h'.y_consol_Paris - l.y_consol_Paris 
				}

				 
				/* Run the LPs */
				* Levels
				eststo clear
				cap drop b u d Days Zero
				gen Days = _n-1 if _n<=`hmax'
				gen Zero =  0    if _n<=`hmax'
				gen b=0
				gen u=0
				gen d=0
				forv h = 0/`hmax' {
					* levels
					 reg y_consol_Paris_`h' l(0/`lag').y_consol_London l(1/`lag').y_consol_Paris, vce(robust)
				replace b = _b[y_consol_London]                    if _n == `h'+1
				replace u = _b[y_consol_London] + 2.575* _se[y_consol_London]  if _n == `h'+1
				replace d = _b[y_consol_London] - 2.575* _se[y_consol_London]  if _n == `h'+1
				eststo
				}
				* nois esttab , se nocons keep(y_consol_London)
				gen b_level = b

				* Differences
				eststo clear
				cap drop b u d Days Zero
				gen Days = _n-1 if _n<=`hmax'
				gen Zero =  0    if _n<=`hmax'
				gen b=0
				gen u=0
				gen d=0
				forv h = 0/`hmax' {
					 reg y_consol_Parisd`h' l(0/`lag').dy_consol_London l(1/`lag').dy_consol_Paris, vce(robust)
				replace b = _b[dy_consol_London]                     if _n == `h'+1
				replace u = _b[dy_consol_London] + 2.575* _se[dy_consol_London]  if _n == `h'+1
				replace d = _b[dy_consol_London] - 2.575* _se[dy_consol_London]  if _n == `h'+1
				eststo
				}
				* nois esttab , se nocons keep(dy_consol_London)
				
				 
				
					twoway ///
						(rarea u d  Days,  ///
						fcolor(gs13) lcolor(gs13) lw(none) lpattern(solid)) ///
						(line b Days, lcolor(blue) ///
						lpattern(solid) lwidth(thick)) ///
						(line Zero Days, lcolor(black)),title("{stMono:Consol} ",size(mediumsmall) color(black)) legend(off) ///
						graphregion(color(white)) plotregion(color(white)) ///
						ysc(r(-0.3 0.8)) ylabel(-0.2(0.2)0.8, angle(0) grid) xtitle("")
						
						* ytitle("Percent", size(medsmall)) xtitle("Days", size(medsmall)) ///

 						
						
						graph export "$Replicationdirectory/_Work/TEMP/CONSOL_Paris_London_POSTDEFAULT_DIF.pdf", replace 
						
						graph save "$Replicationdirectory/_Work/TEMP/CONSOL_Paris_London_POSTDEFAULT_DIF", replace 
				
		 			 
								 
									
									 
